package com.sefon.autocreate;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OptionalDataException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 
* Copyright: Copyright (c) 2018 SefonSoft
* 
* @ClassName: BasicTableInfo.java
* @Description: 基本表配置
*
* @version: v1.0.0
* @author: SF2170
* @date: 2018年3月21日下午8:39:48
*
 */
public class BasicTableInfo implements Serializable{
	
	/**
	 *  @Fields serialVersionUID : TODO
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 描述
	 */
	private String tableDesc;
	
	/**
	 * 表名
	 */
	private String tableName;
	
	/**
	 * 类名
	 */
	private String className;
	
	/**
	 * id列 单独保存
	 */
	private Column idCol;
	
	/**
	 * 列名
	 */
	private List<Column> columns = new ArrayList<>();

	public String getTableDesc() {
		return tableDesc;
	}

	public void setTableDesc(String tableDesc) {
		this.tableDesc = tableDesc;
	}

	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public List<Column> getColumns() {
		return columns;
	}

	public void setColumns(List<Column> columns) {
		this.columns = columns;
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}
	
	public Column getIdCol() {
		return idCol;
	}

	public void setIdCol(Column idCol) {
		this.idCol = idCol;
	}

	/**
	 * 
	* @Description: 对象深copy
	*
	* @return
	* @throws IOException
	* @throws OptionalDataException
	* @throws ClassNotFoundException
	* @return：
	* @throws：
	*
	* @version: v1.0.0
	* @author: SF2170
	* @date: 2018年3月22日 上午1:43:31 
	*
	* Modification History:
	* Date         Author          Version            Description
	*---------------------------------------------------------*
	* 2018年3月22日     SF2170           v1.0.0               修改原因
	 */
    public BasicTableInfo deepClone() throws IOException, OptionalDataException,
             ClassNotFoundException {
         // 将对象写到流里
         ByteArrayOutputStream bo = new ByteArrayOutputStream();
         ObjectOutputStream oo = new ObjectOutputStream(bo);
         oo.writeObject(this);
         // 从流里读出来
         ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
         ObjectInputStream oi = new ObjectInputStream(bi);
         return (BasicTableInfo)(oi.readObject());
     }  
}





